from . import getweb, models
from django.core import serializers
from django.forms.models import model_to_dict


def get_chart_moneyflow_from_eastmoney(ts_code):
    return getweb.get_chart_moneyflow_from_eastmoney(ts_code)


def get_new_moneyflow(ts_code):
    new_moneyflow = models.moneyflow.objects.filter(ts_code=ts_code).order_by("-trade_date")[0]
    new_moneyflow = model_to_dict(new_moneyflow)
    return  new_moneyflow
